package cn.duli.xianer.service.impl;

import cn.duli.xianer.dao.GoodsCommentMapper;
import cn.duli.xianer.pojo.GoodsComment;
import cn.duli.xianer.service.GoodsCommentService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodsCommentServiceImpl implements GoodsCommentService {

    @Resource
    private GoodsCommentMapper goodsCommentMapper;

    @Override
    public List<GoodsComment> findByGoodId(Integer gId) {
        return goodsCommentMapper.findByGoodId(gId);
    }

    @Override
    public void save(GoodsComment goodsComment) {
        goodsCommentMapper.save(goodsComment);
    }

    @Override
    public Page<GoodsComment> findByUserId(Integer uId) {
        return goodsCommentMapper.findByUserId(uId);
    }

    @Override
    public void deleteById(Integer id) {
        goodsCommentMapper.deleteById(id);
    }

    @Override
    public Page<GoodsComment> findAll() {
        return goodsCommentMapper.findAll();
    }

    @Override
    public void deleteByParentId(Integer pId) {
        goodsCommentMapper.deleteByParentId(pId);
    }

    @Override
    public List<GoodsComment> findByParentId(Integer pId) {
        return goodsCommentMapper.findByParentId(pId);
    }

    @Override
    public int findAllCount() {
        return goodsCommentMapper.findAllCount();
    }

    @Override
    public int findCountsByGid(Integer gId) {
        return goodsCommentMapper.findCountsByGid(gId);
    }
}
